package com.example.demo1.controller;

import com.alibaba.nacos.api.exception.NacosException;
import com.example.demo1.pojo.StudentCollectionPojo;
import com.example.demo1.pojo.StudentPojo;
import com.example.demo1.service.CallService;
import com.example.demo1.service.NacosConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/api")
public class AController {

    @Autowired
    private CallService callService;

    /**
     * http://127.0.0.1:8080/api/callb/15
     * @param age
     * @return
     * @throws NacosException
     * @throws IOException
     */
    @GetMapping("/callb/{age}")
    public String getStudentByAge(@PathVariable int age) throws NacosException, IOException {
        System.out.println("查询的学生Age=" + age);
        String content = callService.callB(age);
        return content;
    }
}